﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net.Sockets;

namespace udp_cl_net
{
	public partial class Form1 : Form
	{
		UdpClient	udp_cl	=	new UdpClient();
		TcpClient	tcp_cl	=	null;
		
	
		public Form1()
		{
			InitializeComponent();
		}

		private void refreshToolStripMenuItem_Click(object sender, EventArgs e)
		{
			string msg_text = "\0\0\0\0qqqqqq-blah-blah-blah.NET\0";
			byte[] msg	    = Encoding.ASCII.GetBytes(msg_text);
			udp_cl.Send(msg, msg.Length, "255.255.255.255", 12345);
		}

		private void connectToolStripMenuItem_Click(object sender, EventArgs e)
		{
			string msg_text = "TCP-blah-blah-blah.NET";
			byte[] msg	    = Encoding.ASCII.GetBytes(msg_text);
			string msg_text2 = "boo-boo-boo.NET";
			byte[] msg2	    = Encoding.ASCII.GetBytes(msg_text2);
			
			tcp_cl	=	new TcpClient();
			tcp_cl.Connect("127.0.0.1", 26800);
			
			
			NetworkStream stream = tcp_cl.GetStream();

			/*stream.Write(msg, 0, msg.Count());
			stream.Write(msg2, 0, msg2.Count());*/
			 
		}
	}
}
